package com.ruoyi.common.utils;

import com.ruoyi.common.utils.uuid.UUID;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DocumentUtils {

    public static String PURCHASE = "CGSQ";

    public static String RECEIVE = "LYSQ";
    public static String getPurchaseId(){
        return getId(PURCHASE);
    }


    public static String getReceiveId(){
        return getId(RECEIVE);
    }


    public static String getId(String code){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
        String format = simpleDateFormat.format(new Date());
        String uuid = UUID.randomUUID().toString().replace("-", "").substring(0, 4);
        return code+"-"+format+"-"+uuid;
    }

    public static String getUUid(){
        String uuid = UUID.randomUUID().toString().replace("-", "").substring(0, 18);
        return uuid;
    }

    public static String getApplicationNumber(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyymmddhhmmssSSS");
        return "MR"+simpleDateFormat.format(new Date());
    }

    public static String getDeliveryNumber(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyymmddhhmmssSSS");
        return "SA"+simpleDateFormat.format(new Date());
    }
}
